home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / toolkit / riruf1 / rufutil.bas < prev    next >
Encoding:
BASIC Source File  |  1995-03-23  |  2.7 KB  |  113 lines

  1. Option Explicit
  2. Declare Function FindWindow Lib "user" (ByVal lpClassName As Any, ByVal lpCaption As String) As Integer
  3. Declare Function ShowWindow Lib "User" (ByVal Handle As Integer, ByVal Cmd As Integer) As Integer
  4. Declare Function SetWFocus Lib "User" Alias "setfocus" (ByVal Handle As Integer) As Integer
  5. Const Hourglass% = 11
  6. Const Arrow% = 0
  7. Global MainForm As form
  8.  
  9. Sub AddNewItem (ctrl As Control, sItem As String, lItemIndex As Long)
  10.     ctrl.AddItem sItem
  11.     ctrl.ItemData(ctrl.NewIndex) = lItemIndex
  12.  
  13. End Sub
  14.  
  15. Sub ArrowCursor ()
  16.     Screen.ActiveForm.MousePointer = Arrow
  17. End Sub
  18.  
  19. Sub CenterFromScreen (i As form)
  20.     i.Top = Screen.Height / 2 - ((i.Height / 2))
  21.     i.Left = Screen.Width / 2 - ((i.Width / 2))
  22. End Sub
  23.  
  24. Sub CenterIt (oldform As form, newform As form)
  25.     newform.Top = (oldform.Top + (oldform.Height / 2)) - ((newform.Height / 2))
  26.     newform.Left = (oldform.Left + (oldform.Width / 2)) - ((newform.Width / 2))
  27. End Sub
  28.  
  29. Function CheckCmdLine (sStr As String) As Integer
  30.     Dim sCmd$
  31.  
  32.     sCmd = Command$
  33.     If InStr(1, sCmd, sStr, 1) Then
  34.         CheckCmdLine = True
  35.     Else
  36.         CheckCmdLine = False
  37.     End If
  38.  
  39. End Function
  40.  
  41. Function Encrypt (ByVal oldstring As String) As String
  42.     Dim i, j, length As Integer
  43.     Dim NewString, cChar As String
  44.  
  45.     NewString = ""
  46.     oldstring = UCase(oldstring)
  47.     length = Len(oldstring)
  48.     For i = 1 To length
  49.         j = Asc(Mid$(oldstring, i, 1))
  50.         If j > 64 And j < 91 Then
  51.             If j < 78 Then
  52.                 j = j + 13
  53.             ElseIf j > 77 Then
  54.                 j = j - 13
  55.             End If
  56.         End If
  57.         cChar = Chr$(j)
  58.         NewString = NewString & cChar
  59.     Next
  60.  
  61.     Encrypt = NewString
  62. End Function
  63.  
  64. Sub fillfullscreen (i As form)
  65.     i.Top = 0
  66.     i.Left = 0
  67.     i.Height = Screen.Height
  68.     i.Width = Screen.Width
  69. End Sub
  70.  
  71. Sub FindProgram (sName As String)
  72.     Dim x%, Handle%
  73.  
  74.     If app.PrevInstance Then
  75.         Handle = FindWindow(0&, sName)
  76.         x = ShowWindow(Handle, 1)
  77.         x = SetWFocus(Handle)
  78.         End
  79.     End If
  80.  
  81. End Sub
  82.  
  83. Sub HourglassCursor ()
  84.     Screen.ActiveForm.MousePointer = Hourglass
  85. End Sub
  86.  
  87. Sub ModalForm (frmNew As form)
  88.         Load frmNew
  89.         CenterFromScreen frmNew
  90.         frmNew.Show 1
  91.         DoEvents
  92. End Sub
  93.  
  94. Sub ModelessForm (frmNew As form)
  95.         Load frmNew
  96.         CenterFromScreen frmNew
  97.         frmNew.Show 0
  98. End Sub
  99.  
  100. Sub SelectText (source As Control)
  101.         source.SelStart = 0
  102.         source.SelLength = Len(source.Text)
  103. End Sub
  104.  
  105. Function ShowYesNo (nVal As Integer) As String
  106.     If nVal = 1 Then
  107.         ShowYesNo = "Yes"
  108.     Else
  109.         ShowYesNo = "No"
  110.     End If
  111. End Function
  112.  
  113.